package book.action;

import book.dao.QueryDao;
import book.dao.Impl.QueryDaoImpl;
import book.entity.Book;

public class queryAction extends BaseAction {
	private String bookname;
	private int bookisbn;
	
	public String execute(){
		QueryDao queryDao=new QueryDaoImpl();
		Book book=null;
		if(bookname!=null){
			book=queryDao.queryByName(bookname);
		}
		if(bookisbn!=0){
			book=queryDao.queryByIsbn(bookisbn);
		}
		if(book!=null){
			getRequest().setAttribute("book", book);
			return SUCCESS;
		}else{
			return ERROR;
		}
	}
	
	public queryAction() {
	}
	public queryAction(String bookname, int bookisbn) {
		this.bookname = bookname;
		this.bookisbn = bookisbn;
	}
	public String getBookname() {
		return bookname;
	}
	public void setBookname(String bookname) {
		this.bookname = bookname;
	}
	public int getBookisbn() {
		return bookisbn;
	}
	public void setBookisbn(int bookisbn) {
		this.bookisbn = bookisbn;
	}	
}
